<?php

namespace app\api\model;

use app\lib\Exception\AddressException;

class UserAddress extends BaseModel
{
    public function user()
    {
        return $this->belongsTo('User','user_id','id');
    }

    public static function getUserAddress($uid)
    {
        $result = self::where('user_id',$uid)->find();
        if(!$result){
            throw new AddressException();
        }
        return $result;
    }
}
